package com.zc58s.rabbitmqdemo3.rabbitmq;

import com.zc58s.rabbitmqdemo3.config.RabbitMQConfig;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author : fujc-dev@qq.com
 * @created : 2022/8/21 10:02
 */
@SpringBootTest
public class RabbitmqTopicsSpringboot {


    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 参数：
     * 1、交换机名称
     * 2、RoutingKey
     * 3、消息内容
     */
    @Test
    public void testSendEmail() {
        String message = "send email message to user";
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_TOPICS_INFORM, "inform.email", message);
    }

}
